<?php
/*
 * @Author: 玛瑙
 * @Date:   2018-04-23 11:10:14
 * @Last Modified by:   Administrator
 * @Last Modified time: 2018-05-28 13:12:01
 */
namespace app\company\model;

class Sqd
{
    /**
     * 申请单管理列表数据
     */
    public function get_list($map, $pageNum, $numPerPage, $count)
    {
        $field = 'o.*, d.user_name, d.license_number';
        if (empty($count)) {
            $result = db('order')
                ->alias('o')
                ->join('driving_license d', 'd.id = o.driving_license_id')
                ->where('o.company_id', session('company.company_id'))
                ->where($map)
                ->field($field)
                ->order('o.subscribe_date desc, o.create_time desc')
                ->page($pageNum, $numPerPage)
                ->select();
        } else {
            $result = db('order')
                ->alias('o')
                ->join('driving_license d', 'd.id = o.driving_license_id')
                ->where('o.company_id', session('company.company_id'))
                ->where($map)
                ->count();
        }
        return $result;
    }
}
